<template>
	<view class="contain">
		<view class="title">
			<view class="avatar">
				<image style="vertical-align: middle" src="@/static/avatar.png" alt="" /><text
					style="vertical-align: middle;">{{info.createUserName}}</text>
			</view>
			<view class="state">

			</view>
		</view>
		<view class="center">
			<view class="">
				<text class="name">联系方式:</text><text>{{info.phone}}</text>
			</view>
			<!-- <view class="">
				<text class="name">报修类型:</text><text>{{info.type}}</text>
			</view> -->
			<view class="">
				<text class="name">受理人:</text><text>{{info.builderName}}</text>
			</view>
			<view class="">
				<text class="name">报修内容:</text><text>{{info.content}}</text>
			</view>
			<view class="">
				<text class="name">附件:</text>
				<image v-if='info.imgs.length>1' v-for="(it,i) in info.imgs" :key="i" mode="widthFix" style="width: 150px;
				height: 150px;margin-left: 30rpx;" :src="it" @tap="previewImg(i,info.imgs)"></image>
				<image v-else mode="widthFix" @tap="previewImg(0,info.imgs)" style="width: 150px;
				height: 150px;margin-left: 30rpx;" :src="info.imgs[0]" ></image>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		faultRepairInfo
	} from '@/api/FaultRepair.js';
	export default {
		data() {
			return {
				info: {
					name: '刘国强',
					phone: '13201312171',
					type: '办公用品',
					user: '王老师',
					content: '桌子腿掉了',
					appendix: ''
				}
			}
		},
		onLoad(op) {
			this.getfaultRepairInfo(op.id)
		},
		methods: {
			//查看大图
			previewImg(current, imgList) {
				console.log('点击查看大图', imgList)
				uni.previewImage({
					current,
					urls: imgList,
					// #ifndef MP-WEIXIN
					indicator: 'number'
					// #endif
				});
			},
			//详情
			async getfaultRepairInfo(id) {
				const {
					data
				} = await faultRepairInfo(id)
				if (data.code == 0) {
					this.info=data.data
					if(this.info.imgs.length){
						this.info.imgs=JSON.parse(this.info.imgs)
					}
				}
				console.log('返回数据',)
			},
		}
	}
</script>

<style lang="scss">
	.contain {
		background-color: #fff;
		overflow: hidden;
		padding: 20rpx 0 0;
	}
	.avatar{
		image{
			width: 40rpx;
			height: 40rpx;
		}
	}
	.title {
		padding: 40rpx 30rpx 25rpx;
		border-bottom: 1rpx solid #dadbde;
		font-size: 30rpx;
	}

	.center {
		padding: 20rpx 20rpx;

		view {
			margin-bottom: 10rpx;
			font-size: 30rpx;
			// border-bottom: 1rpx solid #dadbde;
			padding: 20rpx 0;
		}

		text {
			color: #999;
			margin-left: 20rpx;

		}
	}
</style>